<?php
/**
 * @copyright SilverBiology, LLC
 * @author Balachandran Viswanathan
 */

require_once( $config['basePath'] . 'resources/api/class.MysqliDatabase.php');
require_once( $config['basePath'] . 'resources/api/class.queue_occurrence.php');
require_once( $config['basePath'] . 'resources/api/class.log.php');
require_once( $config['basePath'] . 'resources/api/misc.php');
require_once( $config['basePath'] . 'resources/api/class.master_image.php');
require_once( $config['basePath'] . 'resources/api/class.master_images.php');
//require_once( $config['basePath'] . 'resources/api/sdk-1.3.2/sdk.class.php');

Class Lsu {
	public  $log, $error, $db;

	public function __construct() {
		global $config;
		$this->load();
		$this->logger = new Logger();
		$this->queueOccurrence = new QueueOccurrence();
        //$this->amazon = new AmazonS3($config["s3"]["key"],$config["s3"]["sec"]);
        $this->images = new Images();
		$this->image = new Image();
		$this->logger->db = &$this->db;
		$this->queueOccurrence->db = &$this->db;
	}

	public function load() {
		global $config;
		$connection_string = sprintf(
				"server=%s; database=%s; username=%s; password=%s;"
			, DB_SERVER
			, DB_NAME
			, DB_USER
			, DB_PASSWORD
		);
		$this->db = new MysqliDatabase($connection_string);
		return true;
	}

	function getError($error_code) {
		$ar = array (
			  100 => 'Not signed in.'
			, 101 => 'Not a Valid Task.'
			, 104 => 'Not a Valid Code.'
			, 105 => 'Log entry not present.'
			, 106 => 'Not Allowed.'
			, 107 => 'Access not allowed in this private group'
			, 108 => 'No record from queue. Queue is most likely empty.'
			, 200 => 'Access Denied.'
		);
		return $ar[$error_code];
	}
}
?>